local sk__huoxin = fk.CreateSkill {

  name = "sk__huoxin",

  tags = { Skill.Compulsory, },

}



sk__huoxin:addEffect(fk.DamageInflicted, {
  anim_type = "control",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(sk__huoxin.name) and data.from and not data.from.dead
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:doIndicate(player.id, {data.from.id})
    local all_choices = {"sk__huoxin1:"..player.id, "sk__huoxin2"}
    local choices = table.simpleClone(all_choices)
    if data.from:isAllNude() then
      table.remove(choices, 1)
    end
    local choice = room:askForChoice(data.from, choices, sk__huoxin.name, nil, false, all_choices)
    if choice == "sk__huoxin2" then
      room:loseHp(data.from, 1, sk__huoxin.name)
      return true
    else
      local card_data = {}
      if data.from:getHandcardNum() > 0 then
        local handcards = {}
        for i = 1, data.from:getHandcardNum(), 1 do
          table.insert(handcards, -1) -- 手牌不可见
        end
        table.insert(card_data, {"$Hand", handcards})
      end
      local areas = {["$Equip"] = Player.Equip, ["$Judge"] = Player.Judge}
      for k, v in pairs(areas) do
        if #data.from.player_cards[v] > 0 then
          table.insert(card_data, {k, data.from:getCardIds(v)})
        end
      end
      local ret = room:askForPoxi(player, "sk__huoxin_get", card_data, nil, false)
      local cards = table.filter(ret, function(id) return id ~= -1 end)
      local hand_num = #ret - #cards
      if hand_num > 0 and data.from ~= player then
        table.insertTable(cards, table.random(data.from:getCardIds("h"), hand_num))
      end
      room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonPrey, sk__huoxin.name, nil, false, player)
    end
  end,
})

return sk__huoxin